package com.zds.scm.service.impl;

import java.io.Serializable;
import java.util.List;

import com.zds.scm.dao.DeptInfoDAO;
import com.zds.scm.dao.impl.DeptInfoDAOImpl;
import com.zds.scm.domain.DeptInfo;
import com.zds.scm.service.DeptInfoService;

public class DeptInfoServiceImpl implements DeptInfoService {

	private DeptInfoDAO deptInfoDAO=new DeptInfoDAOImpl();
	@Override
	public boolean delete(Serializable id) {
		DeptInfo deptInfo=new DeptInfo();
		deptInfo.setDeptCode(id.toString());
		return deptInfoDAO.delete(deptInfo);
	}

	@Override
	public List<DeptInfo> findAll() {
		return deptInfoDAO.findAll();
	}

	@Override
	public DeptInfo findById(Serializable id) {
		return deptInfoDAO.findById(id);
	}

	@Override
	public boolean insert(DeptInfo deptInfo) {
		return deptInfoDAO.insert(deptInfo);
	}

	@Override
	public boolean update(DeptInfo deptInfo) {
		return deptInfoDAO.update(deptInfo);
	}
	@Override
	public List<DeptInfo> findAll(int currentPage, int pageSize){
		 return deptInfoDAO.findAll(currentPage, pageSize);
	}
	@Override
	public int getTotalRows(){
		return deptInfoDAO.getTotalRows();
	}
	@Override
	public List<DeptInfo> findByNameAndCode(String likeDeptName,String likeDeptCode,int currentPage, int pageSize){
		return deptInfoDAO.findByNameAndCode(likeDeptName, likeDeptCode, currentPage, pageSize);
	}
	@Override
	public int getTotalRowsByNameAndCode(String likeDeptName,String likeDeptCode){
		return deptInfoDAO.getTotalRowsByNameAndCode(likeDeptName, likeDeptCode);
	}
}
